#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //创建Teacher对象
    this->zt= new Teacher(this);


    //创建Student对象
    this->st= new Student(this);

    //创建连接
    connect(zt,&Teacher::hungry,st,&Student::treat);
    classisover();

}
void Widget::classisover()
{
    //下课函数，触发饿了信号
    emit  zt->hungry();//触发信号
}

Widget::~Widget()
{
    delete ui;
}

